import http from '@/utils/http'

export interface LoginRequest {
  username: string
  password: string
}

export interface LoginResponse {
  token: string
  username: string
  nickname: string
  avatar: string
}

export interface UserInfo {
  id: string
  username: string
  nickname: string
  avatar: string
  phone: string
  email: string
  gender: number
  status: number
  deptId: string
}

export const authAPI = {
  login: (data: LoginRequest) => http.post<LoginResponse>('/api/auth/login', data),
  logout: () => http.post('/api/auth/logout'),
  getUserInfo: () => http.get<UserInfo>('/api/auth/userinfo')
}